<template>
  <div>
    <el-card shadow="never" class="d2-mb">
    <div class="mb">
      <el-button type="default" size="small" @click="add">
        <d2-icon name="plus" />
        增行
      </el-button>
      <el-button type="default" size="small" icon="el-icon-delete">
        删行
      </el-button>
    </div>
    <el-table :data="pmtableData" border>
      <el-table-column type="index" :index="indexMethod" label="序号">
      </el-table-column>
      <el-table-column prop="status" label="状态*" sortable>
        <template slot-scope="scope">
           <el-select  clearable v-model="scope.row.status" placeholder="请选择" filterable allow-create>
			         <el-option label="停用" value="0"></el-option>
               <el-option label="启用" value="1"></el-option>
			     </el-select>
         </template>
      </el-table-column>
      <el-table-column prop="category" label="品类*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-model="scope.row.category"
          ></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="seller" label="品名*" sortable>
        <template slot-scope="scope">
          <el-input placeholder="请输入内容" v-model="scope.row.name"></el-input>
        </template>
      </el-table-column>
      <el-table-column prop="sign" label="品名ID*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="amount_1" label="商品单位*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template></el-table-column
      >
      <el-table-column prop="name" label="计量单位*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="税种*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="seller" label="开始日期*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template></el-table-column
      >
      <el-table-column prop="sign" label="税率*" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="amount_1" label="品牌" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="产地" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="seller" label="规格" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="sign" label="主属性" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="amount_1" label="备注" sortable>
        <template slot-scope="scope">
          <el-input
            placeholder="请输入内容"
            v-show="scope.row.show"
            v-model="scope.row.address"
          ></el-input>
          <span v-show="!scope.row.show">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
    </el-table>
    </el-card>
  </div>
</template>
<script>
export default {
  //商品信息-现货信息-新增
  name: "spotInformation_M",
  props: ["rowaa"],
  data() {
    return {
      formData: "",
      tableData: [{ name: "11", address: "22", show: true }]
    };
  },
  created() {
    this.getData();
  },
  watch: {
    rowaa: "getData"
  },
  methods: {
    // 新增
    addPMList(){
      let params = {
            operation: "ADD",
            "commodity_data":this.pmtableData
        };
        addExposure(params).then(res => {
                this.$message.success(res.result);
                this.$router.push('/merchandise_news')
             }).catch(err =>{
          this.$message.error(err.msg);
        });
    },
    getData() {
      //从后台获取数据逻辑 model.CacheModel.get('api/' + this.rowaa + '.json')
      //通过this.rowaa就可以获取传过来的值
      this.formData = 333;
    }
  }
};
</script>
